<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let person={
      name:'张三',
      age:19
    }
    // let p={
    // }
    // Object.defineProperty(p,'name',{
    //   configurable:true,
    //   set(val){
    //     person.name=val
    //     console.log('有刺客修改',val);
    //   },
    //   get(){
    //     return person.name
    //   }
    // })
    let p=new Proxy(person,{
      set(target,propName,val){
        console.log('修改');
        // target[propName]=val
        Reflect.set(target,propName,val)

      },
      get(target,propName){
        console.log('读取');
        // return target[propName]
        return Reflect.get(target,propName)
      },
      deleteProperty(target,propName){
        console.log('删除');
        return Reflect.deleteProperty(target,propName) 
      }
    })
  </script>
</body>
</html>